<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			
		var arr = [10,50,100,20,70,60];
		var str = '10---50---100---20---70---60';
		console.log(str.split("---"));
		console.log(typeof(str.split("---")))
		
		console.log('arr.join("---") ' ,arr.join("---") )
		
		
		var arr1 = [10,20];
		var arr2 = [30,40,50];
		var arr3 = arr1.concat(arr2); //对arr1没有影响
		console.log("arr1", arr1);
		console.log("arr2", arr2);
		console.log("arr3", arr3);
		
		
		arr3.push("追加到元素末尾");
		console.log("arr3", arr3);
		console.log("pop====");
		var pop = arr3.pop();
		console.log("pop:"+pop)
		console.log("arr3", arr3);
		
		var emptpArr = [];
		let result = emptpArr.pop();
		console.log("result",result);
		
		
		
		
		//在队列开始的位置
		var arr4 = [900,700,800];
		arr4.unshift(1000);
		console.log("arr4", arr4);
		console.log("result",result);
		var shift = arr4.shift();
		console.log("shift:"+shift)
		console.log("arr4", arr4);
		
		var emptpArr2 = [];
		let shiftResult = emptpArr2.shift();
		console.log("shiftResult",shiftResult);
		
		
		//数组的排序数组排序会影响原有数组的值
		var unSortArr = [ 1,900,70,200,60,800,95];
		
		console.log('unSortArr ' ,unSortArr)
		console.log('unSortArr.sort().join("--") ' ,unSortArr.sort().join("--"))
		
		
		var sortArr = [1,2,3,4,5,6,7,8];
		console.log("sortArr before sort ",sortArr);
		console.log("sortArr.reverse()",sortArr.reverse()); //会改变原有数组的值
		console.log("sortArr after sort",sortArr);
		
		
		//数组的切片    [8,7,6,5,4,3,2,1]
		console.log("sortArr.slice(3)",sortArr.slice(3))
		console.log("sortArr.slice(3,5)",sortArr.slice(3,5))  // [3,5)
		
		//从数组中移除元素
		let spliceArr =[0,1,2,3,4,5,6,7,8];
		console.log("spliceArr",spliceArr);
		spliceArr.splice(2,3);
		console.log("spliceArr.splice(2,3)",spliceArr);
		
		
		
		
		
		</script>
	</head>
	<body>
	</body>
</html>
